package com.jswlw.vo;

import com.jswlw.entity.biz.DistributionAccounts;
import lombok.Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 吴维斌 E-mail:wuweibin0817@163.com
 * @version 创建时间：1:50 2019/3/16
 */
@Data
public class DistributionAccountsVo {

    private Integer id;

    private Integer distributorId;

    private String startTime;

    private String endTime;

    private Integer amount;

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

    public DistributionAccounts toDistributionAccounts() {
        DistributionAccounts distributionAccounts = new DistributionAccounts();
        distributionAccounts.setId(this.id);
        distributionAccounts.setDistributorId(this.distributorId);
        try {
            distributionAccounts.setStartTime(sdf.parse(this.startTime));
            distributionAccounts.setEndTime(sdf.parse(this.endTime));
        } catch (ParseException e) {
            e.printStackTrace();
        }

        distributionAccounts.setAmount(this.amount);
        return distributionAccounts;
    }
}
